package Test;

import domain.Student1;

import java.util.ArrayList;
import java.util.Scanner;

public class Demo10 {
    public static void main(String[] args) {
        ArrayList<Student1> list = new ArrayList<Student1>();
        method(list);
        method(list);
        method(list);
        System.out.println(list.get(0).getName()+"...."+list.get(0).getAge());
        System.out.println(list.get(1).getName()+"...."+list.get(1).getAge());
        System.out.println(list.get(2).getName()+"...."+list.get(2).getAge());
    }
    public static void method(ArrayList<Student1> list) {
        Scanner sc = new Scanner(System.in);
        String name = sc.next();
        int age = sc.nextInt();
        list.add(new Student1(name,age));
    }
}
